home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 4_0 / UUPC3 / MAC_SPEC / MLIB.C < prev    next >
Text File  |  1989-11-20  |  636b  |  49 lines

  1. /*        lib.c
  2.  
  3.  
  4.         macintosh library
  5.         
  6.  
  7.     Things to do in uu host
  8.  
  9.         serial I/O
  10.         
  11.         directory stuff
  12.             opendir, readdir, closedir
  13.  
  14.         prolog and epilog
  15.  
  16.         system call
  17.  
  18. */
  19.  
  20. #include <stdio.h>
  21. #include "host.h"
  22. #ifndef  THINK_C
  23. #include <sgtty.h>
  24.  
  25. int get_one()
  26. {
  27.     char c;
  28.     
  29.     struct sgttyb stty, sttyo;
  30.     ioctl( 0, TIOCGETP, &stty );
  31.     sttyo = stty;
  32.     stty.sg_flags |= CBREAK;
  33.     stty.sg_flags &= ~ ECHO;
  34.     ioctl( 0, TIOCSETP, &stty );
  35.     c = fgetc( stdin );
  36.     ioctl( 0, TIOCSETP, &sttyo );
  37.     return( c );
  38. }
  39. #else
  40. # include <console.h>
  41. get_one() {
  42.     int ch;
  43.     csetmode(C_CBREAK, stdin);
  44.     ch = getc(stdin);
  45.     csetmode(C_ECHO, stdin);
  46.     return(ch); 
  47. }
  48. #endif
  49.